package com.luotf.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.luotf.mapper.CommentsMapper;
import com.luotf.model.Comments;
import com.luotf.service.CommentsService;
import com.luotf.util.Comments_util;

@Service
public class CommentsServiceimpl implements CommentsService {
	
	@Autowired
	private CommentsMapper commentsmapper;
	
	/**
	 * 
	 */
	public List<Comments> queryByBlogid(Integer blogid) {
		//查询这篇博客的所有博客
		List<Comments> commentarr = commentsmapper.queryByBlogid(blogid);
		//组装评论
		commentarr = Comments_util.AssemblyComments(commentarr);
		return commentarr;
	}
	
	/**
	 * 
	 */
	public Integer insertComment(Comments comment) {
		return commentsmapper.insertComment(comment);
	}

	@Override
	public Integer deletecomment(Integer commentid) {
		// TODO Auto-generated method stub
		return commentsmapper.deletecomment(commentid);
	}

	

}
